import request from '/@/utils/request';

/**
 * 以下为模拟接口地址，gitee 的不通，就换自己的真实接口地址
 *
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 后端控制菜单模拟json，路径在 https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu
 * 后端控制路由，isRequestRoutes 为 true，则开启后端控制路由
 * @method getAdminMenu 获取后端动态路由菜单(admin)
 * @method getTestMenu 获取后端动态路由菜单(test)
 */
export function useUserApi() {
	return {
		// getAdminMenu: (params?: object) => {
		// 	return request<any, AjaxResult>({
		// 		url: '/Org/GetAdminMenu',
		// 		method: 'post',
		// 		params,
		// 	});
		// },
		// getOrgTreeList: (params?: object) => {
		// 	return request<any, AjaxResult>({
		// 		url: '/org/GetTreeList',
		// 		method: 'get',
		// 		params,
		// 	});
		// },
		getUserPage: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/PageList',
				method: 'post',
				data,
			});
		},
		getUserList: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/user/List/',
				method: 'get',
				params,
			});
		},
		getUserRoleIdList: (id:number) => {
			return request<any, AjaxResult>({
				url: '/user/OwnRoleList/'+id,
				method: 'get',
				//params,
			});
		},
		getUserExtOrgIdList: (id:number) => {
			return request<any, AjaxResult>({
				url: '/user/ownExtOrgList/'+id,
				method: 'get',
				//params,
			});
		},
		addUser: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/Add',
				method: 'post',
				data,
			});
		},
		editUser: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/Update',
				method: 'post',
				data,
			});
		},
		userResetPwd: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/ResetPwd',
				method: 'post',
				data,
			});
		},
		userDelete: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/Delete',
				method: 'post',
				data,
			});
		},
		SetStatus: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/SetStatus',
				method: 'post',
				data,
			});
		},
		getBaseInfo: (params?:object) => {
			return request<any, AjaxResult>({
				url: '/user/baseInfo',
				method: 'get',
				params,
			});
		},
		postBaseInfo: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/baseInfo',
				method: 'post',
				data,
			});
		},
		postChangePwd: (data={}) => {
			return request<any, AjaxResult>({
				url: '/user/changePwd',
				method: 'post',
				data,
			});
		},
	};
}
